package com.qfoud.edu.aunt.commons.dao;

import com.qfoud.edu.aunt.commons.pojo.User;

import java.sql.SQLException;
import java.util.List;

/**
 * @author xiaobobo
 * @title: IUserDAO
 * @projectName cd-java-2303-project-parent
 * @description: TODO
 * @date 2023/5/11  9:07
 */
public interface IUserDAO {
    /**
     * 查询所有的数据
     * @return
     */
    List<User> list() throws Exception;

    /**
     * 通过id删除数据
     * @param id
     */
    void deleteById(Integer id) throws Exception;

    /**
     * 通过id查询用户对象
     * @param id
     * @return
     */
    User findUserById(Integer id) throws Exception;

    /**
     * 通过id更新用户信息
     * @param user
     */
    void update(User user) throws Exception;

    /**
     * 添加用户
     * @param user
     */
    void insert(User user) throws Exception;

    /**
     * 通过用户名查询用户数据
     * @param username
     * @return
     */
    User findUserByName(String username) throws Exception;
}
